/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InfoPanel.java
 *
 * Created on 12.6.2011, 13:58:28
 */
package forms;

import src.Zak;

/**
 *
 * @author Viktor
 */
public class InfoPanel extends javax.swing.JPanel {
Zak zobrZak;
int mesic;
    /** Creates new form InfoPanel */
    public InfoPanel(Zak zobr, int mesic) {
        initComponents();
        setSize(1000, 50);
        zobrZak = zobr;
        this.mesic = mesic;
    }

    public void setZobrZak(Zak zobrZak) {
        this.zobrZak = zobrZak;
        
        update(zobrZak);
        if(this.zobrZak != null){
         jmenoLabel.setText(this.zobrZak.getJmeno());
         prijmeniLabel.setText(this.zobrZak.getPrijmeni()); 
         telefonLabel.setText(this.zobrZak.getTelefon());
         adresaLabel.setText(this.zobrZak.getBydliste());
         datnarLabel.setText(this.zobrZak.getDatNar());
         jProgressBar1.setValue((int)zobrZak.dochazkaProc(mesic));
         jProgressBar1.setString(String.valueOf((int)zobrZak.dochazkaProc(mesic)) + " %");
         jProgressBar1.setStringPainted(true);
         
        }
    }

    public Zak getZobrZak() {
        return zobrZak;
    }

    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    
    private void update(Zak z){
        if(z != null){
         jmenoLabel.setText(z.getJmeno());
         prijmeniLabel.setText(z.getPrijmeni()); 
         telefonLabel.setText(z.getTelefon());
         adresaLabel.setText(z.getBydliste());
         datnarLabel.setText(z.getDatNar());
         
         repaint();
         
        }
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jmenoLabel = new javax.swing.JLabel();
        prijmeniLabel = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        telefonLabel = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        adresaLabel = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        datnarLabel = new javax.swing.JLabel();
        jProgressBar1 = new javax.swing.JProgressBar();
        jLabel2 = new javax.swing.JLabel();

        setBackground(new java.awt.Color(153, 204, 255));

        jmenoLabel.setText("<nevybráno>");

        prijmeniLabel.setFont(new java.awt.Font("Tahoma", 1, 12));
        prijmeniLabel.setText("<nevybráno>");

        jLabel1.setText("telefon : ");

        telefonLabel.setText("<nevybráno>");

        jLabel3.setText("adresa :");

        adresaLabel.setText(" <nevybráno>");

        jLabel5.setText("Dat. nar :");

        datnarLabel.setText("<nevybráno>");

        jProgressBar1.setForeground(new java.awt.Color(0, 255, 0));

        jLabel2.setText("Dochazka :");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(prijmeniLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jmenoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(120, 120, 120)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(adresaLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 336, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(telefonLabel)
                        .addGap(67, 67, 67)
                        .addComponent(jLabel5)
                        .addGap(18, 18, 18)
                        .addComponent(datnarLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(325, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(prijmeniLabel)
                    .addComponent(jLabel1)
                    .addComponent(telefonLabel)
                    .addComponent(jLabel5)
                    .addComponent(datnarLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jmenoLabel)
                        .addComponent(jLabel3)
                        .addComponent(adresaLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2))
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel adresaLabel;
    private javax.swing.JLabel datnarLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JLabel jmenoLabel;
    private javax.swing.JLabel prijmeniLabel;
    private javax.swing.JLabel telefonLabel;
    // End of variables declaration//GEN-END:variables
}
